<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
	</head>
	<e:View id="view">
		<script type="text/javascript">SkinUtil.getSkin();</script>
		<script type="text/javascript">SkinUtil.getModuleSkin();</script>
		    
		<div id="Invisual Controls" style="min-height: 40px; background-color: LemonChiffon;" >
			<e:Dataset id="Dataset_FlowTemplate" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="Dataset_FlowTemplate" pageSize="10" loadDataCommand="Command_Load" allowMultiSelect="false">
				<e:Field name="templateId" dataType="string" label="流程ID" maxLength="32" />
				 <e:Field name="templateName" dataType="string" label="流程名称" maxLength="100" />
				 <e:Field name="sortNo" dataType="long" label="排序号" maxLength="4"  required="true"/>
				 <e:Field name="viewUrl" dataType="string" label="流程查看地址" maxLength="200" />
				 <e:Field name="remark" dataType="string" label="备注" maxLength="200" />
			</e:Dataset>
			
			<e:Command id="Command_Search" action="com.longtop.framework.sys.flow.web.FlowTemplateListAction" method="searchFlowTemplate" submitForm="true" submitFormScope="all" validateRequired="true">
				<e:DatasetInfo name="DatasetInfo2" dataset="Dataset_FlowTemplate" alwayRefreshClient="true" submitType="none"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Save" action="com.longtop.framework.sys.flow.web.FlowTemplateListAction" method="saveFlowTemplate" submitForm="true" validateRequired="true" onExecuteSuccess="Button_Search_onClick()">
				<e:DatasetInfo name="DatasetInfo4" dataset="Dataset_FlowTemplate" alwayRefreshClient="false" submitType="changes"></e:DatasetInfo>
			</e:Command>
			<e:Command id="Command_Load" action="com.longtop.framework.sys.flow.web.FlowTemplateListAction" method="loadFlowTemplate" showHintInfoOnSuccess="false">
				<e:DatasetInfo name="DatasetInfo3" dataset="Dataset_FlowTemplate" alwayRefreshClient="true"></e:DatasetInfo>
			</e:Command>
		</div>
		
		<body>
			<e:Page id="ePage" action="com.longtop.framework.sys.flow.web.FlowTemplateListAction" style="min-height: 80px; width: 100%; height: 100%;">
				<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
					<tr>
						<td align="left" valign="top">
							<e:Panel id="Panel_Search" style="width: 285px; height: 100%" caption="查询条件" captionIcon="/images/query_win.gif" captionStyle="color:#888888" allowFold="true"  showArrowButton="false">
								<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" width="100%" align="center">
									<tr>
										<td width="80px" align="right">
											<e:Label id="Label_templateId" caption="流程ID" />
										</td>
										<td>
											<e:Text id="Text_templateId" style="width: 169px" ></e:Text>
										</td>
									</tr>
									<tr>
										<td align="right">
											<e:Label id="Label_templateName" caption="流程名"></e:Label>
										</td>
										<td>
											<e:Text id="Text_templateName" style="width:169px;"></e:Text>
										</td>
									</tr>
									<tr>
										<td align="right">
											<e:Label id="Label_remark" caption="备注" />
										</td>
										<td>
											<e:Text id="Text_remark" style="width: 169px" ></e:Text>
										</td>
									</tr>
									<tr>
										<td></td>
										<td>
											<e:Button id="Button_Search" style='height: 22px; width: 70px' caption="查询" command="Command_Search" icon="/images/query.gif" onClick="Button_Search_onClick()"></e:Button>&nbsp;&nbsp;
									</tr>
								</table>
							</e:Panel>
						</td>
						<td valign="top" width="100%">
							<e:Panel id="Panel_Result" style="width: 100%; height: 100%" captionStyle="color:#888888" caption="查询结果列表" captionIcon="/images/list_win.gif">
								<table style="text-align: left; width: 100%;" border="0" cellpadding="3" cellspacing="3" >
									<tr>
										<td>
											<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
												<tr>
													<td height="27px" width="1%">
														<e:RecordNavigator id="RecordNavigator_Index" dataset="Dataset_FlowTemplate" showNavigatorButton="false">
															<e:RecordButton id="RecordButton_insert" label="新增" onClick="insertRecord" icon="/images/add.gif"></e:RecordButton>
															<e:RecordButton id="RecordButton_delete" label="删除" onClick="deleteRecord" icon="/images/delete.gif"></e:RecordButton>
															<e:RecordButton id="RecordButton_save" label="保存" icon="/images/submit.gif" onClick="RecordButton_save_onClick()"></e:RecordButton>
															<e:RecordButton id="RecordButton_showNode" label="关联流程节点" icon="/images/edit.gif" onClick="RecordButton_flowNode_onClick()"></e:RecordButton>
														</e:RecordNavigator>
													</td>
													<td align="left" width="99%"><e:PageNavigator id="PageNavigator_Template" dataset="Dataset_FlowTemplate" showRecordNum="true"></e:PageNavigator></td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td>
											<e:Grid id="Grid_FlowTemplate" style="width: 100%; height: 100%;" showIndex="true" dataset="Dataset_FlowTemplate" onClick="Grid_FlowTemplate_onClick()" >
											</e:Grid>
										</td>
									</tr>
								</table>
							</e:Panel>
						</td>
					</tr>
			    </table>
			</e:Page>
		</body>
		<script type="text/javascript">
			
			//查询
			function Button_Search_onClick(){
			    Command_Search.execute();
			}
			
			//保存
			function RecordButton_save_onClick(){
			    Command_Save.execute();
			}	
			
			//单击记录,确定主键是否可编辑
			function Grid_FlowTemplate_onClick(){
				var element = event.srcElement;
				if(element.isDataCell){
					if(element.isDataCell){
				        var currentRecord = element.record;
				        if(currentRecord.state == Constant.RECORD.STATE_NEW || currentRecord.state == Constant.RECORD.STATE_INSERT) {
			          		currentRecord.dataset.getField("templateId").setReadOnly(false);
			          	} else{
					        currentRecord.dataset.getField("templateId").setReadOnly(true);
			       		}
					}
				}
			}
			
			//关联流程节点	
			function RecordButton_flowNode_onClick(){
				var record = Dataset_FlowTemplate.getCurrentRecord();
				
				if(record){
					var id = record.getValue("templateId");
					if(id != null && id != ''){
						var path = "/jsp/framework/sys/flow/flowNodeList.jsp?templateId="+id+"&doflag="+"edit";
						openTab("node_list"+id,"关联流程节点["+id+"]",path);
					}
				}
			}	
		</script>
	</e:View>
</html>
